<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>Faiss: faiss::Score3Computer&lt; Ttab, Taccu &gt; Struct Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Faiss
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Friends</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacefaiss.html">faiss</a></li><li class="navelem"><a class="el" href="structfaiss_1_1Score3Computer.html">Score3Computer</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-attribs">Public Attributes</a> &#124;
<a href="structfaiss_1_1Score3Computer-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">faiss::Score3Computer&lt; Ttab, Taccu &gt; Struct Template Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="dynheader">
Inheritance diagram for faiss::Score3Computer&lt; Ttab, Taccu &gt;:</div>
<div class="dyncontent">
 <div class="center">
  <img src="structfaiss_1_1Score3Computer.png" usemap="#faiss::Score3Computer&lt; Ttab, Taccu &gt;_map" alt=""/>
  <map id="faiss::Score3Computer&lt; Ttab, Taccu &gt;_map" name="faiss::Score3Computer&lt; Ttab, Taccu &gt;_map">
<area href="structfaiss_1_1PermutationObjective.html" title="abstract class for the loss function " alt="faiss::PermutationObjective" shape="rect" coords="0,0,231,24"/>
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a07a726903418960a2d8000506d88f8e6"><td class="memItemLeft" align="right" valign="top">Taccu&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1Score3Computer.html#a07a726903418960a2d8000506d88f8e6">compute</a> (const int *perm) const </td></tr>
<tr class="separator:a07a726903418960a2d8000506d88f8e6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a567feac7ddd3bb467a9ed30671caccb1"><td class="memItemLeft" align="right" valign="top">Taccu&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1Score3Computer.html#a567feac7ddd3bb467a9ed30671caccb1">compute_update</a> (const int *perm, int iw, int jw) const </td></tr>
<tr class="separator:a567feac7ddd3bb467a9ed30671caccb1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1a44799c391adf3a9170e96e7643e9ae"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1a44799c391adf3a9170e96e7643e9ae"></a>
Taccu&#160;</td><td class="memItemRight" valign="bottom"><b>update_i</b> (const int *perm, int iw, int jw, int ip0, int ip, const Ttab *n_gt_i) const </td></tr>
<tr class="separator:a1a44799c391adf3a9170e96e7643e9ae"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8a9f9d95c9a4c0948cb5df0b04c5ebc8"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8a9f9d95c9a4c0948cb5df0b04c5ebc8"></a>
Taccu&#160;</td><td class="memItemRight" valign="bottom"><b>update_i_plane</b> (const int *perm, int iw, int jw, int ip0, int ip, const Ttab *n_gt_i) const </td></tr>
<tr class="separator:a8a9f9d95c9a4c0948cb5df0b04c5ebc8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a227601c3dc8779bb13747ba04934e0c8"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a227601c3dc8779bb13747ba04934e0c8"></a>
Taccu&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1Score3Computer.html#a227601c3dc8779bb13747ba04934e0c8">update_k</a> (const int *perm, int iw, int jw, int ip0, int ip, int jp0, int jp, int k, const Ttab *n_gt_ij) const </td></tr>
<tr class="memdesc:a227601c3dc8779bb13747ba04934e0c8"><td class="mdescLeft">&#160;</td><td class="mdescRight">used for the 8 cells were the 3 indices are swapped <br/></td></tr>
<tr class="separator:a227601c3dc8779bb13747ba04934e0c8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a98da6005edbb5ec26311bc947866122d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a98da6005edbb5ec26311bc947866122d"></a>
Taccu&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1Score3Computer.html#a98da6005edbb5ec26311bc947866122d">update_j_line</a> (const int *perm, int iw, int jw, int ip0, int ip, int jp0, int jp, const Ttab *n_gt_ij) const </td></tr>
<tr class="memdesc:a98da6005edbb5ec26311bc947866122d"><td class="mdescLeft">&#160;</td><td class="mdescRight">compute update on a line of k's, where i and j are swapped <br/></td></tr>
<tr class="separator:a98da6005edbb5ec26311bc947866122d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acf371848bac76ba275ceb5e10f805d33"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="acf371848bac76ba275ceb5e10f805d33"></a>
Taccu&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1Score3Computer.html#acf371848bac76ba275ceb5e10f805d33">update_i_cross</a> (const int *perm, int iw, int jw, int ip0, int ip, const Ttab *n_gt_i) const </td></tr>
<tr class="memdesc:acf371848bac76ba275ceb5e10f805d33"><td class="mdescLeft">&#160;</td><td class="mdescRight">considers the 2 pairs of crossing lines j=iw or jw and k = iw or kw <br/></td></tr>
<tr class="separator:acf371848bac76ba275ceb5e10f805d33"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1c4537d67802aef28ccc57c4bd87f766"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1Score3Computer.html#a1c4537d67802aef28ccc57c4bd87f766">compute_cost</a> (const int *perm) const override</td></tr>
<tr class="separator:a1c4537d67802aef28ccc57c4bd87f766"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acbce8973c5294f8495a89100c111c5b3"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="acbce8973c5294f8495a89100c111c5b3"></a>
double&#160;</td><td class="memItemRight" valign="bottom"><b>cost_update</b> (const int *perm, int iw, int jw) const override</td></tr>
<tr class="separator:acbce8973c5294f8495a89100c111c5b3"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Public Attributes</h2></td></tr>
<tr class="memitem:a39a449545b35ca4a3a01db109526832e"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a39a449545b35ca4a3a01db109526832e"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><b>nc</b></td></tr>
<tr class="separator:a39a449545b35ca4a3a01db109526832e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac054431b63a010a8cfe013b40eac746a"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac054431b63a010a8cfe013b40eac746a"></a>
std::vector&lt; Ttab &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>n_gt</b></td></tr>
<tr class="separator:ac054431b63a010a8cfe013b40eac746a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_attribs_structfaiss_1_1PermutationObjective"><td colspan="2" onclick="javascript:toggleInherit('pub_attribs_structfaiss_1_1PermutationObjective')"><img src="closed.png" alt="-"/>&#160;Public Attributes inherited from <a class="el" href="structfaiss_1_1PermutationObjective.html">faiss::PermutationObjective</a></td></tr>
<tr class="memitem:a81657be192b4589b13a3f51fc0765c2f inherit pub_attribs_structfaiss_1_1PermutationObjective"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a81657be192b4589b13a3f51fc0765c2f"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><b>n</b></td></tr>
<tr class="separator:a81657be192b4589b13a3f51fc0765c2f inherit pub_attribs_structfaiss_1_1PermutationObjective"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><h3>template&lt;typename Ttab, typename Taccu&gt;<br/>
struct faiss::Score3Computer&lt; Ttab, Taccu &gt;</h3>

<p>Maintains a 3D table of elementary costs. Accumulates elements based on Hamming distance comparisons </p>

<p>Definition at line <a class="el" href="PolysemousTraining_8cpp_source.html#l00444">444</a> of file <a class="el" href="PolysemousTraining_8cpp_source.html">PolysemousTraining.cpp</a>.</p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a07a726903418960a2d8000506d88f8e6"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Ttab, typename Taccu&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">Taccu <a class="el" href="structfaiss_1_1Score3Computer.html">faiss::Score3Computer</a>&lt; Ttab, Taccu &gt;::compute </td>
          <td>(</td>
          <td class="paramtype">const int *&#160;</td>
          <td class="paramname"><em>perm</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>the cost is a triple loop on the nc * nc * nc matrix of entries. </p>

<p>Definition at line <a class="el" href="PolysemousTraining_8cpp_source.html#l00456">456</a> of file <a class="el" href="PolysemousTraining_8cpp_source.html">PolysemousTraining.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a1c4537d67802aef28ccc57c4bd87f766"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Ttab, typename Taccu&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">double <a class="el" href="structfaiss_1_1Score3Computer.html">faiss::Score3Computer</a>&lt; Ttab, Taccu &gt;::compute_cost </td>
          <td>(</td>
          <td class="paramtype">const int *&#160;</td>
          <td class="paramname"><em>perm</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">override</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p><a class="el" href="structfaiss_1_1PermutationObjective.html" title="abstract class for the loss function ">PermutationObjective</a> implementeation (just negates the scores for minimization) </p>

<p>Implements <a class="el" href="structfaiss_1_1PermutationObjective.html">faiss::PermutationObjective</a>.</p>

<p>Definition at line <a class="el" href="PolysemousTraining_8cpp_source.html#l00632">632</a> of file <a class="el" href="PolysemousTraining_8cpp_source.html">PolysemousTraining.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a567feac7ddd3bb467a9ed30671caccb1"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Ttab, typename Taccu&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">Taccu <a class="el" href="structfaiss_1_1Score3Computer.html">faiss::Score3Computer</a>&lt; Ttab, Taccu &gt;::compute_update </td>
          <td>(</td>
          <td class="paramtype">const int *&#160;</td>
          <td class="paramname"><em>perm</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>iw</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>jw</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>cost update if entries iw and jw of the permutation would be swapped.</p>
<p>The computation is optimized by avoiding elements in the nc*nc*nc cube that are known not to change. For nc=256, this reduces the nb of cells to visit to about 6/256 th of the cells. Practical speedup is about 8x, and the code is quite complex :-/ </p>

<p>Definition at line <a class="el" href="PolysemousTraining_8cpp_source.html#l00487">487</a> of file <a class="el" href="PolysemousTraining_8cpp_source.html">PolysemousTraining.cpp</a>.</p>

</div>
</div>
<hr/>The documentation for this struct was generated from the following file:<ul>
<li>/data/users/hoss/faiss/<a class="el" href="PolysemousTraining_8cpp_source.html">PolysemousTraining.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>
